package com.ruoyi.rsikManage.service.Impl;


import com.ruoyi.rsikManage.domain.TMapAvoidance;
import com.ruoyi.rsikManage.mapper.TMapAvoidanceMapper;
import com.ruoyi.rsikManage.service.ITMapAvoidanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-09
 */
@Service
public class TMapAvoidanceServiceImpl implements ITMapAvoidanceService {
    @Autowired
    private TMapAvoidanceMapper tMapAvoidanceMapper;


    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public TMapAvoidance selectTMapAvoidanceById(Long id) {
        return tMapAvoidanceMapper.selectTMapAvoidanceById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param tMapAvoidance 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<TMapAvoidance> selectTMapAvoidanceList(TMapAvoidance tMapAvoidance) {
        return tMapAvoidanceMapper.selectTMapAvoidanceList(tMapAvoidance);
    }

    @Override
    public List<Map> selectTopList() {

        List list = new ArrayList();

        Map result = new HashMap();
        TMapAvoidance tMapAvoidance = new TMapAvoidance();


        List<TMapAvoidance> tMapAvoidancesList = tMapAvoidanceMapper.selectTMapAvoidanceList(tMapAvoidance);

        int monitoringPoint = tMapAvoidancesList.size();

        List<Map> RiskPointsList = tMapAvoidanceMapper.selectRiskPointsList();

        int RiskPoints = RiskPointsList.size();

        List<Map> RisksList = tMapAvoidanceMapper.selectRisksList();

        int Risks = RisksList.size();

        result.put("monitoringPoint",monitoringPoint);
        result.put("RiskPoints",RiskPoints);
        result.put("Risks",Risks);

        list.add(result);

        return list;
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param tMapAvoidance 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertTMapAvoidance(TMapAvoidance tMapAvoidance) {
        return tMapAvoidanceMapper.insertTMapAvoidance(tMapAvoidance);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param tMapAvoidance 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateTMapAvoidance(TMapAvoidance tMapAvoidance) {
        return tMapAvoidanceMapper.updateTMapAvoidance(tMapAvoidance);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTMapAvoidanceByIds(Long[] ids) {
        return tMapAvoidanceMapper.deleteTMapAvoidanceByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTMapAvoidanceById(Long id) {
        return tMapAvoidanceMapper.deleteTMapAvoidanceById(id);
    }

    @Override
    @Deprecated
    public List<Map<String, Object>> getSystemAvoidanceInfo(String mineCode,
                                                            String systemId,
                                                            String mapId) {
        return tMapAvoidanceMapper.getSystemAvoidanceInfo(mapId, mineCode, systemId);
    }

    @Override
    public List<Map<String, Object>> getShortList(TMapAvoidance tMapAvoidance) {
        return tMapAvoidanceMapper.getShortList(tMapAvoidance);
    }

}
